package com.xyz;

// 定义 Logging 日志类，用来 Aop 横切入学生业务系统，实现日志记录功能
public class Logging {
    /**
     * This is the method which I would like to execute
     * before a selected method execution.
     */
    //在切入的业务逻辑方法之前执行这个 aop 方法
    public void beforeAdvice(){
        System.out.println("准备设置学生档案.");
    }
    /**
     * This is the method which I would like to execute
     * after a selected method execution.
     */
    //在切入的业务逻辑方法之后执行这个 aop 方法
    public void afterAdvice(){
        System.out.println("学生档案设置完成.");
    }
    /**
     * This is the method which I would like to execute
     * when any method returns.
     */
    // 方法执行成功后返回
    public void afterReturningAdvice(Object retVal){
        System.out.println("返回:" + retVal.toString() );
    }
    /**
     * This is the method which I would like to execute
     * if there is an exception raised.
     */
    // 当出现异常时执行
    public void AfterThrowingAdvice(IllegalArgumentException ex){
        System.out.println("出现异常: " + ex.toString());
    }
}
